﻿using System.Collections.Generic;
using Ops.Host.Core.Models;
using Ops.Host.Core.Services;

namespace Ops.Host.App.ViewModels;

public sealed class EnergyConsumptionViewModel : SinglePagedViewModelBase<EnergyConsumption, EnergyConsumptionFilter>
{
    private readonly IEnergyConsumptionService _energyConsumptionService;

    public EnergyConsumptionViewModel(IEnergyConsumptionService energyConsumptionService)
    {
        _energyConsumptionService = energyConsumptionService;

        InitSearch();
    }

    public override string DownloadFileName()
    {
        return "能耗信息" + base.DownloadFileName();
    }

    protected override (IEnumerable<EnergyConsumption> items, long pageCount) OnSearch(int pageIndex, int pageSize)
    {
        return _energyConsumptionService.GetPaged(QueryFilter, pageIndex, pageSize);
    }
}
